Connection and Control Access for PosgreSQL
What does control access do?
This is a configuration from posgresql, where you can define who can access and manage specific rules inside of your Database. This access is managed by roles
How do I create a new role
- PosgreSQL uses roles to represent user accounts
- roles can own database objects
- When roles containing other roles, these are called group roles
CREATE ROLE rolename WITH [options]
Based on Postgres Documentation
CREATE ROLE _`name`_ [ [ WITH ] _`option`_ [ ... ] ]
where _`option`_ can be:
SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB
| CREATEROLE | NOCREATEROLE
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
| REPLICATION | NOREPLICATION
| BYPASSRLS | NOBYPASSRLS
| CONNECTION LIMIT _`connlimit`_
| [ ENCRYPTED ] PASSWORD '_`password`_' | PASSWORD NULL
| VALID UNTIL '_`timestamp`_'
| IN ROLE _`role_name`_ [, ...]
| ROLE _`role_name`_ [, ...]
| ADMIN _`role_name`_ [, ...]
| SYSID _`uid`_
Command setting connection
psql -U username -d database
If you need to specify the host
psql -h host -U username -d database
References